package vip.liux.backend.infrastructure.jpa.shop;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import vip.liux.backend.domain.models.shop.address.UserAddress;
import vip.liux.backend.domain.models.shop.address.UserAddressRepository;

public interface UserAddressJpaRepository extends JpaRepository<UserAddress, Long>, UserAddressRepository {

    @Override
    @Modifying
    @Query("update UserAddress set defaultAddress = false where id != ?1")
    void updateNotDefaultAddress(Long addressId);
}